<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<script type="text/javascript">
			function funload() {
				proxy('http://www.baidu.com/', function(data) {
					console.log(data);
				});
			}
	
			function proxy(url, func) {
				var isFirst = true,
					ifr = document.createElement('iframe'),
					loadFunc = function() {
						if(isFirst) {
							ifr.contentWindow.location = 'http://a.com/cs1.html';
							isFirst = false;
						} else {
							func(ifr.contentWindow.name);
							ifr.contentWindow.close();
							document.body.removeChild(ifr);
							ifr.src = '';
							ifr = null;
						}
					};

				ifr.src = url;
				ifr.style.display = 'none';
				if(ifr.attachEvent) ifr.attachEvent('onload', loadFunc);
				else ifr.onload = loadFunc;

				document.body.appendChild(ifr);
			}
		</script>
	</head>

	<body>
		<button onclick="funload()">载入</button>
	</body>

</html>